package com.heima;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/***
 *@title RegexDemo07
 *@description <TODO description class purpose>
 *@author 12468
 *@version 1.0.0
 *@create 2025-09-03 23:56
 **/
public class RegexDemo07 {
    public static void main(String[] args) throws IOException {
        // 创建一个URL对象
        URL url = new URL("https://m.sengzan.com/jiaoyu/29104.html?ivk sa=1025883i");
        // 链接上这个网址
        URLConnection urlConnection = url.openConnection();
        // 创建一个对象去读取网络中的数据
        BufferedReader br = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
        String line;
        String regex = "[1-9]\\d{17}";
        Pattern p = Pattern.compile(regex);
        while((line = br.readLine()) != null) {
            Matcher m = p.matcher(line);
            while(m.find()) {
                String s = m.group();
                System.out.println(s);
            }
        }
    }
}
